package com.dayu.web.vo;

import com.alibaba.fastjson.JSONObject;

/**
 * 返回类
 * 
 * @author Chenjiawei
 *
 *         2017年5月24日
 */
public class RESTResponse<T> {

	public int Code;
	public String Message;

	public T Response;

	public RESTResponse(int Code, String Message, T Response) {

		this.Code = Code;
		this.Response = Response;
		this.Message = Message;
	}

	public static <V> RESTResponse<V> of(V Response) {

		return new RESTResponse<V>(0, null, Response);
	}

	public static <V> RESTResponse<V> of(int Code, String Message) {

		return new RESTResponse<V>(Code, Message, null);
	}

	@Override
	public String toString() {

		return JSONObject.toJSONString(this);
	}

	public String get() {
		return toString();
	}
}
